package com.mnt.gui.base.style;

import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import com.mnt.gui.base.controller.BaseController;
import com.mnt.gui.base.controller.OutBorderController;
import com.mnt.gui.base.util.FXMLLoaderTool;

/**
 * display window type
 * 
 * @author cico.mnt
 * @date 2014-5-17
 */
public enum WindowStyle {
	WINDOW_MNT { // mnt window

		private OutBorderController outBorderController;
		
		@Override
		public void setRoot(BaseController root) {
			outBorderController.setRoot(root);
		}

		@Override
		public void buildStageByStyle(Stage stage, BaseController root) {
			outBorderController = FXMLLoaderTool.<OutBorderController>load(OutBorderController.class);
			Scene scene = new Scene(outBorderController);
			stage.setScene(scene);
			stage.initStyle(StageStyle.UNDECORATED);
			setRoot(root);
		}

		@Override
		public void setTitle(String title) {
			outBorderController.setTitle(title);
		}
		
	} , 
	WINDOW_DEFAULT { // system window
		
		private Stage stage;
		
		@Override
		public void setRoot(BaseController root) {
			stage.getScene().setRoot(root);
		}

		@Override
		public void buildStageByStyle(Stage stage, BaseController root) {
			this.stage = stage;
			stage.setScene(new Scene(root));
			
		}

		@Override
		public void setTitle(String title) {
			stage.setTitle(title);
		}
	}, 
	WINDOW_MULTI { // TODO multi window 
		@Override
		public void setRoot(BaseController root) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void buildStageByStyle(Stage stage, BaseController root) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void setTitle(String title) {
			// TODO Auto-generated method stub
			
		}
	}; 

	/**
	 * set root node
	 * @param root
	 */
	public abstract void setRoot(BaseController root);
	
	public abstract void buildStageByStyle(Stage stage, BaseController root);
	
	/**
	 * set window title
	 * @param title
	 */
	public abstract void setTitle(String title);
	
}
